import { observable, makeAutoObservable } from "mobx";
import type { CesiumUtil } from "vendor/components/pro-cesium";
import { MapEventBus } from "./MapEventBus";

export class GisMapStore{
    cesiumUtil: CesiumUtil;
    mapEventBus: MapEventBus;

    constructor(){
        makeAutoObservable(this, {
            cesiumUtil: observable.ref,
        })
    }

    setCesiumUtil = (cesiumUtil: CesiumUtil) => {
        this.cesiumUtil = cesiumUtil;
        this.mapEventBus = new MapEventBus(cesiumUtil.viewer);
    }

    destroy = () => {
        this.mapEventBus.destroy();
        this.cesiumUtil.destroy();
    }
}